/*
 * logger.h
 *
 *  Created on: 03/mag/2014
 *      Author: kappa
 */

#ifndef LOGGER_H_
#define LOGGER_H_

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "errors.h"

#ifdef _WIN32
	#include <Windows.h>
#else
	#include <unistd.h>
	#include <sys/stat.h>
	#include <fcntl.h>
	#include <string.h>
	#include <syslog.h>
	#include "ui.h"

#endif

#define LOG_ID "pkmailsod"
#define LOG_FOLDER "log"

typedef enum level{
	INFO_LEV,WARN_LEV,ERR_LEV, DBG_LEV
} LEVEL;

static const char INFO_HEAD[] = "INFO: ";
static const char WARN_HEAD[] = "WARN: ";
static const char ERR_HEAD[] = "ERR: ";
static const char DBG_HEAD[] = "DEBUG: ";

void initLogger(void);
void openLogger(void);
void closeLogger(void);
void logMessage(LEVEL , char* message);
#ifdef _WIN32
int isRotateLog(void);
void rotateLog(void);
#endif
#ifndef _WIN32
int decodeLevelToPriority(LEVEL);
#endif
#endif /* LOGGER_H_ */
